
#%%

#Import Library
import numpy as np, pandas as pd
from sklearn import svm
# Assumed you have, X (predictor) and Y (target) for training data set and x_test(predictor) of test_dataset
# Create SVM classification object
krkData = pd.read_csv("D:/PyCharmProjects/MainProjects/anaconda-numpy/machine_learning/SVM/KingRockVSKing/krkopt.data")
krkData.head()

#%%

# test and train set
rows = krkData.shape[0]

trainData = krkData.iloc[0:round(rows / 5 * 4) - 1,:]
testData = krkData.iloc[rows * 4 - 1:rows,:]

cols = krkData.shape[1]
X = krkData.iloc[:,0:cols-1]
y = krkData.iloc[:,cols-1:cols]

#%%

model = svm.SVC(kernel='linear', C=1, gamma=1)
# there is various option associated with it, like changing kernel, gamma and C value. Will discuss more # about it in next section.Train the model using the training sets and check score
model.fit(X, y)
model.score(X, y)
# Predict Output
#predicted= model.predict(x_test)